package user.controller;

import common.model.Appeal;
import common.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import user.Service.UserService;

@RestController
@RequestMapping("/user/profile")
public class UserProfileController {

    @Autowired
    private UserService userService;

    @PutMapping("/update")
    public ResponseEntity<User> updateUserProfile(@RequestBody User user) {
        return ResponseEntity.ok(userService.updateProfile(user));
    }

    @GetMapping("/get/{id}")
    public ResponseEntity<User> getUserProfile(@PathVariable Long id) {
        return ResponseEntity.ok(userService.getProfile(id));
    }

    @PostMapping("/appeal")
    public ResponseEntity<Void> userAppealFreeze(@RequestBody Appeal appeal) {
        userService.appealFreeze(appeal);
        return ResponseEntity.noContent().build();
    }

    @GetMapping("/contactSupport")
    public ResponseEntity<Void> userContactSupport() {
        // 实现联系客服逻辑
        return ResponseEntity.noContent().build();
    }
}
